﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WoWConnecter
{
	/// <summary>
	/// Loot threshold
	/// </summary>
	public enum ItemQuality : uint
	{
		Poor = 0,
		Common = 1,
		Uncommon = 2,
		Rare = 3,
		Epic = 4,
		Legendary = 5,
		Artifact = 6,
		End
	}

	/// <summary>
	/// Used in the ITEMFLAGS updatefield
	/// </summary>
	[Flags]
	public enum ItemFlags : uint
	{
		None = 0,

		Soulbound = 0x1, // PER ITEM, NOT PROTO

		/// <summary>
		/// Warlock/Mage stones, water etc
		/// </summary>
		Conjured = 0x2,

		/// <summary>
		/// Lockboxes, clams etc
		/// </summary>
		Openable = 0x4,

		GiftWrapped = 0x8, // PER ITEM, NOT PROTO

		/// <summary>
		/// Shaman totem tools
		/// </summary>
		Totem = 0x20,

		/// <summary>
		/// Items bearing a spell (Equip/Use/Proc etc) 
		/// </summary>
		TriggersSpell = 0x40,

		/// <summary>
		/// CHECK THIS
		/// </summary>
		NoEquipCooldown = 0x80,

		/// <summary>
		/// These items would appear to do ranged magical damage
		/// ITEM_FLAG_INTBONUSINSTEAD = 0x100
		/// </summary>
		Wand = 0x100,

        /// <summary>
        /// usable..?
        /// </summary>
        Usable = 0x00000040,

		/// <summary>
		/// These items can wrap other items (wrapping paper)
		/// </summary>
		WrappingPaper = 0x200,

		/// <summary>
		/// These items produce other items when right clicked (motes, enchanting essences, darkmoon cards...)
		/// </summary>
		Producer = 0x400,

		/// <summary>
		/// Everyone in the group/raid can loot a copy of the item.
		/// </summary>
		MultiLoot = 0x800,

		/// <summary>
		/// ITEM_FLAG_BRIEFSPELLEFFECTS = 0x1000
		/// </summary>
		BriefSpellEffect = 0x1000,

        /// <summary>
        /// item can be refunded within 2 hours of purchase
        /// </summary>
        Refundable = 0x00001000,

		/// <summary>
		/// Guild charters
		/// </summary>
		Charter = 0x2000,

        /// <summary>
        /// ??? see Refundable
        /// </summary>
        Refundable2 = 0x00008000,

		/// <summary>
		/// "Right Click to Read"
		/// </summary>
		Readable = 0x4000,

		/// <summary>
		/// 
		/// </summary>
		PVPItem = 0x8000,

		/// <summary>
		/// Item expires after a certain amount of time
		/// </summary>
		Expires = 0x10000,

		/// <summary>
		/// Items a jewel crafter can prospect
		/// </summary>
		Prospectable = 0x40000,

		/// <summary>
		/// Items you can only have one of equipped, but multiple in your inventory
		/// </summary>
		UniqueEquipped = 0x80000,

		/// <summary>
		/// Lowers durability on cast (also contains deprecated throwing weapons)
		/// </summary>
		ThrownWeapon = 0x400000,

		AccountBound = 0x8000000,

        EnchantScroll = 0x10000000,

		Millable = 0x20000000,
	}

	public enum ItemSubClass
	{
		None = -1,
		// Weapon
		WeaponAxe = 0,
		WeaponTwoHandAxe = 1,
		WeaponBow = 2,
		WeaponGun = 3,
		WeaponMace = 4,
		WeaponTwoHandMace = 5,
		WeaponPolearm = 6,
		WeaponSword = 7,
		WeaponTwoHandSword = 8,
		WeaponFist = 13,
		WeaponDagger = 15,
		WeaponStaff = 10,
		WeaponMisc = 14,
		WeaponThrown = 16,
		WeaponCrossbow = 18,
		WeaponWand = 19,
		WeaponFishingPole = 20,

		// Armor
		ArmorMisc = 0,
		ArmorCloth = 1,
		ArmorLeather = 2,
		AmorMail = 3,
		ArmorPlate = 4,
		ArmorShield = 6,

		// Projectile
		ProjectileArrow = 2,
		ProjectileBullet = 3,

		// Trade goods
		ITEM_SUBCLASS_PROJECTILE_TRADE_GOODS = 0,
		ITEM_SUBCLASS_PROJECTILE_PARTS = 1,
		ITEM_SUBCLASS_PROJECTILE_EXPLOSIVES = 2,
		ITEM_SUBCLASS_PROJECTILE_DEVICES = 3,

		// Recipe
		ITEM_SUBCLASS_RECIPE_BOOK = 0,
		ITEM_SUBCLASS_RECIPE_LEATHERWORKING = 1,
		ITEM_SUBCLASS_RECIPE_TAILORING = 2,
		ITEM_SUBCLASS_RECIPE_ENGINEERING = 3,
		ITEM_SUBCLASS_RECIPE_BLACKSMITHING = 4,
		ITEM_SUBCLASS_RECIPE_COOKING = 5,
		ITEM_SUBCLASS_RECIPE_ALCHEMY = 6,
		ITEM_SUBCLASS_RECIPE_FIRST_AID = 7,
		ITEM_SUBCLASS_RECIPE_ENCHANTING = 8,
		ITEM_SUBCLASS_RECIPE_FISHING = 9,

		// Quiver
		AmmoPouch = 3,
		Quiver = 2,

		// Misc
		Junk = 0,
	}

	[Flags]
	public enum ItemSubClassMask : uint
	{
		None = 0,

		AnyMeleeWeapon = 0x2A5F3,
		AnyRangedWeapon = 0x4000C,

		WeaponAxe = 1,
		WeaponTwoHandAxe = 0x000000002,
		WeaponBow = 0x000000004,
		WeaponGun = 0x000000008,
		//WeaponMace = 0x000000008,
		WeaponPolearm = 0x000000010,
		WeaponTwoHandMace = 0x000000020,
		Shield = 0x000000040,
		WeaponOneHandSword = 0x00000080,
		WeaponTwoHandSword = 0x00000100,
		/// <summary>
		/// Only in: NotDisplayed Totem (Id: 27763)
		/// </summary>
		UnknownSubClass1 = 0x00000200,
		WeaponStaff = 0x00000400,
		WeaponFist = 0x00002000,
		WeaponDagger = 0x00008000,
		WeaponThrown = 0x00010000,
		UnknownSubClass2 = 0x00020000,
		WeaponCrossbow = 0x00040000,
		WeaponWand = 0x00080000,
		WeaponFishingPole = 0x00100000,

		ArmorMisc = 1,
		ArmorCloth = 2,
		ArmorLeather = 4,
		ArmorMail = 8,
		ArmorPlate = 0x10,
		ArmorShield = 0x40,
	}

	public enum InventorySlotType
	{
		None = 0,
		Head = 1,
		Neck = 2,
		Shoulder = 3,
		Body = 4,
		Chest = 5,
		Waist = 6,
		Legs = 7,
		Feet = 8,
		Wrist = 9,
		Hand = 10,
		Finger = 11,
		Trinket = 12,
		Weapon = 13,
		Shield = 14,
		Ranged = 15,
		Cloak = 16,
		TwoHandWeapon = 17,
		Bag = 18,
		Tabard = 19,
		Robe = 20,
		WeaponMainHand = 21,
		WeaponOffHand = 22,
		Holdable = 23,
		Ammo = 24,
		Thrown = 25,
		RangedRight = 26,
		/// <summary>
		/// Ammo pouch
		/// </summary>
		Quiver = 27,
		Relic = 28,
	}

	[Flags]
	public enum InventorySlotMask
	{
		None = 0,
		Head = 0x002,
		Neck = 0x000004,
		Shoulder = 0x000008,
		Body = 0x000010,
		Chest = 0x000020,
		Waist = 0x00040,
		Legs = 0x00080,
		Feet = 0x000100,
		Wrist = 0x00200,
		Hand = 0x00400,
		Finger = 0x00800,
		Trinket = 0x01000,
		Weapon = 0x02000,
		Shield = 0x04000,
		Ranged = 0x08000,
		Cloak = 0x10000,
		TwoHandWeapon = 0x20000,
		Bag = 0x040000,
		Tabard = 0x080000,
		Robe = 0x00100000,
		WeaponMainHand = 0x00200000,
		WeaponOffHand = 0x00400000,
		Holdable = 0x00800000,
		Ammo = 0x01000000,
		Thrown = 0x02000000,
		RangedRight = 0x04000000,
		/// <summary>
		/// Ammo pouch
		/// </summary>
		Quiver = 0x08000000,
		Relic = 0x10000000
	}


	public enum EquipmentSlot : int
	{
		Invalid = -1,
		Head = 0,
		Neck = 1,
		Shoulders = 2,
		Shirt = 3,
		Chest = 4,
		Belt = 5,
		Pants = 6,
		Boots = 7,
		Wrist = 8,
		Gloves = 9,
		Finger1 = 10,
		Finger2 = 11,
		Trinket1 = 12,
		Trinket2 = 13,
		Back = 14,
		MainHand = 15,
		OffHand = 16,
		ExtraWeapon = 17,
		Tabard = 18,
		Bag1,
		Bag2,
		Bag3,
		BagLast,
		End
	}

	/// <summary>
	/// 
	/// </summary>
	public enum InventorySlot
	{
		/// <summary>
		/// Usually used for default container (Player Inventory) or Ammo
		/// </summary>
		Head = 0,
		Neck = 1,
		Shoulders = 2,
		Shirt = 3,
		Chest = 4,
		Belt = 5,
		Pants = 6,
		Boots = 7,
		Wrist = 8,
		Gloves = 9,
		Finger1 = 10,
		Finger2 = 11,
		Trinket1 = 12,
		Trinket2 = 13,
		Back = 14,
		MainHand = 15,
		OffHand = 16,
		ExtraWeapon = 17,
		Tabard = 18,

		Bag1 = 19,
		Bag2,
		Bag3,
		BagLast,

		BackPack1 = 23,
		BackPack2,
		BackPack3,
		BackPack4,
		BackPack5,
		BackPack6,
		BackPack7,
		BackPack8,
		BackPack9,
		BackPack10,
		BackPack11,
		BackPack12,
		BackPack13,
		BackPack14,
		BackPack15,
		/// <summary>
		/// BackPack16 (amount might change in the future)
		/// </summary>
		BackPackLast,

		Bank1 = 39,
		Bank2,
		Bank3,
		Bank4,
		Bank5,
		Bank6,
		Bank7,
		Bank8,
		Bank9,
		Bank10,
		Bank11,
		Bank12,
		Bank13,
		Bank14,
		Bank15,
		Bank16,
		Bank17,
		Bank18,
		Bank19,
		Bank20,
		Bank21,
		Bank22,
		Bank23,
		Bank24,
		Bank25,
		Bank26,
		Bank27,
		/// <summary>
		/// Bank28 (amount might change in the future)
		/// </summary>
		BankLast,

		BankBag1 = 67,
		BankBag2,
		BankBag3,
		BankBag4,
		BankBag5,
		BankBag6,
		/// <summary>
		/// BankBag7 (amount might change in the future)
		/// </summary>
		BankBagLast = 73,

		BuyBack1 = 74,
		BuyBack2,
		BuyBack3,
		BuyBack4,
		BuyBack5,
		BuyBack6,
		BuyBack7,
		BuyBack8,
		BuyBack9,
		BuyBack10,
		BuyBack11,
		/// <summary>
		/// BuyBack12 (amount might change in the future)
		/// </summary>
		BuyBackLast,

		// keyring keys
		Key1 = 86,
		Key2,
		Key3,
		Key4,
		Key5,
		Key6,
		Key7,
		Key8,
		Key9,
		Key10,
		Key11,
		Key12,
		Key13,
		Key14,
		Key15,
		Key16,
		Key17,
		Key18,
		Key19,
		Key20,
		Key21,
		Key22,
		Key23,
		Key24,
		Key25,
		Key26,
		Key27,
		Key28,
		Key29,
		Key30,
		Key31,
		/// <summary>
		/// Key32 (amount might change in the future)
		/// </summary>
		KeyLast,

		Count,
        Invalid = 255
	}

	public enum BagSlot : sbyte
	{
		Invalid = -1,
		Bag1 = 19,
		Bag2,
		Bag3,
		LastBag
	}

	public enum ItemBondType
	{
		None = 0,
		OnPickup = 1,
		OnEquip = 2,
		OnUse = 3,
		Quest = 4,
	}

	public enum ItemSpellTrigger
	{
		Use = 0,
		Equip = 1,
		ChanceOnHit = 2,

		/// <summary>
		/// Only used by: Glowing Sanctified Crystal (ID: 23442)
		/// To cast: Unsummon Sanctified Crystal (Id: 29343)
		/// </summary>
		Unsummon = 3,

		Soulstone = 4,

		/// <summary>
		/// Only used by 3 Quest Items; 
		/// each triggering a Dummy spell which seems to check for another requirement and -if given- allow something to happen
		/// </summary>
		Combo = 5,

		/// <summary>
		/// Casted once and then consumes the Item (usually teaching formulars, patterns, designs etc)
		/// </summary>
		Consume = 6
	}

	public enum ItemProjectileType
	{
		None = 0,
		/// <summary>
		/// Obsolete
		/// </summary>
		Bolts = 1,
		Arrows = 2,
		Bullets = 3,
		Thrown = 4
	}

	public enum EnchantSlot : uint
	{
		Permanent = 0,
		Temporary = 1,
		Socket1 = 2,
		Socket2 = 3,
		Socket3 = 4,
		Bonus = 5,

		PropSlot0 = 6,                        // used with RandomSuffix   (or have HELD enchantments)
		PropSlot1 = 7,                        // used with RandomSuffix   (or have HELD enchantments)
		PropSlot2 = 8,                        // used with RandomSuffix and RandomProperty
		PropSlot3 = 9,                        // used with RandomProperty (or have HELD enchantments)
		PropSlot4 = 10,                       // used with RandomProperty (or have HELD enchantments)
		End
	}

	public enum EnchantInfoOffset
	{
		Id = 0,
		Duration = 1,
		Charges = 2
	}

	public enum ItemSuffixCategory : uint
	{
		MainArmor = 0,
		SecondaryArmor = 1,
		Other = 2,
		Weapon = 3,
		Ranged = 4,
		None
	}

	public enum PartialInventoryType
	{
		Equipment = 0,
		BackPack,
		EquippedContainers,
		Bank,
		BankBags,
		BuyBack,
		KeyRing,

		/// <summary>
		/// The amount of different PartialInventories
		/// </summary>
		Count
	}

	public enum SellItemError : byte
	{
		Success = 0x00,
		CantFindItem = 0x01,
		CantSellItem = 0x02,
		CantFindVendor = 0x03,
		PlayerDoesntOwnItem = 0x04,
		Unknown = 0x05,
		OnlyEmptyBag = 0x06
	}

	public enum BuyItemError : byte
	{
		CantFindItem = 0x00,
		ItemAlreadySold = 0x01,
		NotEnoughMoney = 0x02,
		Unknown1 = 0x03,
		SellerDoesntLikeYou = 0x04,
		DistanceTooFar = 0x05,
		Unknown2 = 0x06,
		ItemSoldOut = 0x07,
		CantCarryAnymore = 0x08,
		Unknown3 = 0x09,
		Unknown4 = 0x10,
		RankRequirementNotMet = 0x11,
		ReputationRequirementNotMet = 0x12
	}

	[Flags]
	public enum SocketColor : uint
	{
		None = 0,
		Meta = 1,
		Red = 2,

		Yellow = 4,

		Blue = 8,

	}

    /// <summary>
    /// Used In CMSG_ITEM_PUSH_RESULT
    /// </summary>
    public enum HowObtained : byte
    {
        Looted = 0,
        NPCTransaction = 1
    }

    /// <summary>
    /// Used In CMSG_ITEM_PUSH_RESULT
    /// </summary>
    public enum HowReceived : byte
    {
        Transaction = 0,
        Created = 1
    }
}
